package request

import "fmt"

const (
	auth                  = "%s/api/south/dal/auth"
	refreshToken          = "%s/api/south/dal/refresh-token"
	subscribe             = "%s/api/south/subscribe/subscribe"
	reportEvent           = "%s/api/south/report/report-event?productKey=%s&sn=%s"
	reportStatus          = "%s/api/south/report/report-status?productKey=%s&sn=%s"
	reportCmdResult       = "%s/api/south/report/report-cmd-result?productKey=%s&sn=%s"
	bindApp               = "%s/api/south/device/bind-app?productKey=%s&sn=%s&appId=%s"
	downloadFirmware      = "%s/api/south/ota/download?productKey=%s&firmsoftId=%s"
	reportUpgradeProgress = "%s/api/south/ota/report-progress?productKey=%s&sn=%s"
	reportGwTopology      = "%s/api/south/device/report-gw-toplogy"
)

func AuthUrl(host string) string {
	return fmt.Sprintf(auth, host)
}

func RefreshTokenUrl(host string) string {
	return fmt.Sprintf(refreshToken, host)
}

func SubscribeUrl(host string) string {
	return fmt.Sprintf(subscribe, host)
}

func ReportEventUrl(host, productKey, sn string) string {
	return fmt.Sprintf(reportEvent, host, productKey, sn)
}

func ReportStatusUrl(host, productKey, sn string) string {
	return fmt.Sprintf(reportStatus, host, productKey, sn)
}

func ReportCmdResultUrl(host, productKey, sn string) string {
	return fmt.Sprintf(reportCmdResult, host, productKey, sn)
}

func BindAppUrl(host, productKey, sn, appId string) string {
	return fmt.Sprintf(bindApp, host, productKey, sn, appId)
}

func DownloadFirmwareUrl(host, productKey, firmsoftId string) string {
	return fmt.Sprintf(downloadFirmware, host, productKey, firmsoftId)
}

func ReportUpgradeProgressUrl(host, productKey, sn string) string {
	return fmt.Sprintf(reportUpgradeProgress, host, productKey, sn)
}

func ReportGwTopologyUrl(host string) string {
	return fmt.Sprintf(reportGwTopology, host)
}
